#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__

#include <pthread.h>

typedef struct task_queue
{
    void (*routine)(void*);
    void *arg;
    struct task_queue *next;
}task_queue_t;

typedef struct threadpool

{
    int shutdown;   //是否消耗
    int max_thread_num;//最大数量
    pthread_t *thread_ids;//线程id数组首地址
    task_queue_t *head;//任务队列队首
    task_queue_t *tail;//任务队列队尾
    pthread_mutex_t queue_lock;
    pthread_cond_t queue_ready;
    i你b
}threadpool_t;
void threadpool_destroy();
int threadpool_add_task(void * (*routine)(void*),void *arg);
int threadpool_create(int num);

#endif 